<%@ page language="java" pageEncoding="utf-8"%>
<%@include file="/commons/taglib.jsp"%>

<html>
<head>
	<script type="text/javascript" src="${rootPath}/js/jquery.js"></script>
	<script type="text/javascript">
		
		function submitForm(){
			var form = document.getElementById( "playerForm" );
			form.action="${rootPath}/player_list.action";
			form.submit();
		}
		
		//保存球员其它信息
		function savePlayerExtend( teamPlayerId ){
			
			var obj = document.getElementById( "footballTeamId" );
			var cfid = obj.options[ obj.selectedIndex ].getAttribute("cfid") ;
			var form = document.getElementById( "playerForm" );
			form.action="${rootPath}/player_savePlayerExtend.action?teamPlayerId="+ teamPlayerId + "&currentFootballTeamId="+cfid;
			form.submit();
		}
			
		
	</script>
	
	<style type="text/css">		
		.tip{
			color:#ff0000;
			font-size:30px;
		}
	</style>
	
</head>
<body>
	<center>
		<form action="${rootPath}/liansai_list.action" method="post" name="playerForm" id="playerForm" >
			足球赛事年份：
			<select name="lianSaiYearId" id="lianSaiYearId" onchange="submitForm()">
				<c:forEach items="${lianSaiYearList}" var="lianSaiYear">
					<option value="${lianSaiYear.id}" <c:if test="${ lianSaiYearId == lianSaiYear.id }">selected</c:if> >
						${lianSaiYear.liansaiYear}
					</option>
				</c:forEach>
			</select><br/>
			
			足球联赛：
			<select name="lianSaiId" id="lianSaiId" onchange="submitForm()">
				<c:forEach items="${lianSaiList}" var="lianSai">
					<option value="${lianSai.id}" <c:if test="${ lianSaiId == lianSai.id }">selected</c:if> >
						${lianSai.chineseName}
					</option>
				</c:forEach>
			</select><br/>
			
			球队：
			<select name="footballTeamId" id="footballTeamId" onchange="submitForm()">
				<c:forEach items="${teamList}" var="team">
					<option cfid="${team.id}" value="${team.footballTeam.id}" <c:if test="${ footballTeamId == team.footballTeam.id }">selected</c:if> >
						${team.footballTeamName}
					</option>
				</c:forEach>
			</select><br/>
			
			<table width="100%" cellpadding="0" border="1" cellspacing="0" >				
				<tr>
					<th align="center" width="5%" >号码</th>
					<th align="center" width="20%" >球员姓名</th>
					<th align="center" width="7%" >位置</th>
		 			<th align="center" width="7%" >国籍</th>
		 			<th align="center" width="5%" >体重</th>
		 			<th align="center" width="5%" >身高</th>
		 			<th align="center" width="10%" >生日</th>
		 			<th align="center" width="10%" >上场时间</th>
		 			<th align="center" width="6%" >球队贡献</th>
		 			<th align="center" width="10%" >总进球</th>
		 			
		 			<th align="center" width="15%" >操作</th>
				</tr>
				
				<c:forEach items="${teamPlayerList}" var="teamPlayer">
					<tr style="${teamPlayer.style}">
						<td align="center" width="5%">
							${teamPlayer.jerseyNumber}
						</td>
						<td align="center" width="20%">
							<a href="${teamPlayer.playerUrl}" target="_blank">${teamPlayer.playerName}</a>
						</td>
													
						<td align="center" width="7%" >
							${teamPlayer.position}
						</td>
						
						<td align="center" width="7%" >
							${teamPlayer.footballPlayer.nationality}
						</td>
						
						<td align="center" width="5%" >
							${teamPlayer.footballPlayer.bodyWeight}
						</td>
						
						<td align="center" width="5%" >
							${teamPlayer.footballPlayer.height}
						</td>
						
						<td align="center" width="10%" >
							${teamPlayer.footballPlayer.birthay}
						</td>
						
						<td align="center" width="10%" >
							${teamPlayer.playSumTime}
						</td>
						<td align="center" width="10%" >
							<c:if test="${teamPlayer.mainPlayer==0}">主力</c:if>
							<c:if test="${teamPlayer.mainPlayer==1}">替补</c:if>
						</td>
						<td align="center" width="6%" >
							${teamPlayer.sumJinQiu}
						</td>
						<td align="center" width="15%" >
							<a href="javascript:void(0);" onclick="javascript:savePlayerExtend('${teamPlayer.id}')" >统计球员</a>
						</td>
						
					</tr>
				</c:forEach>
		
			</table>
		</form>
	</center>
</body>
</html>